Introducing Functions With Arguments

OPENING QUESTION: The function we reviewed yesterday (msg!) was very basic-- we called the function and then ran the function, nothing fancy.

Please review how using just a simple function like that can benefit your code,

OBJECTIVES: I will work with my team to analyze and then write a function that accepts arguments during today's class.

CALENDAR:

WORDS O' THE DAY:

  • Argument (A value 'sent in' to a function to be used there)
  • Parameters (A 'placeholder variable inside a function that 'receives' the argument 'passed into' the function)

WORK O' THE DAY

Now let's jump into the world of functions that 'receive' an argument that is 'passed in' to the function.

Being able to 'feed' a function with a variable gives the function a great deal more (I was going to say functionality!) flexibility!

Take a look at THIS code and add comments to help you more fully understand what is going on there.

When you are done with that, modify that function that includes:

An additional screen object to 'prompt' the user whether they want to calculate the Area (A) of a circle or the Circumference (C) of the circle.

Additional code within the function that outputs the area of the circle or the circumference of the circle as chosen by the user.